package com.lushu.data
{
	import flash.display.BitmapData;
	import flash.geom.Rectangle;

	[RemoteClass]
	public class TilePiece
	{
		private static var maxTileID : int;
		
		public var bitmap : BitmapData;
		public var initRect : Rectangle;
		public var _id : int;
		
		public function TilePiece()
		{
			
		}
		
		public function init(bitmapData : BitmapData, initRect : Rectangle) : void
		{
			this.bitmap = bitmapData;
			this.initRect = initRect;
		}
		
		public function setNewID() : void
		{
			id = maxTileID + 1;
		}
		
		public function set id(value : int) : void
		{
			maxTileID = Math.max(maxTileID, value);
			_id = value;
		}
		
		public function get id() : int
		{
			return _id;
		}
		
		public function clone() : TilePiece
		{
			var tilePiece : TilePiece = new TilePiece();
			tilePiece.bitmap = bitmap;
			tilePiece.initRect = initRect;
			tilePiece.id = _id;
			return tilePiece;
		}
	}
}